package com.igeek.car.mapper;

import com.igeek.car.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单信息表 Mapper 接口
 * </p>
 *
 * @author Suzi
 * @since 2024-12-06
 */
public interface OrdersMapper extends BaseMapper<Orders> {
    @Select("SELECT dispatch_id, COUNT(*) AS orderCount FROM orders GROUP BY dispatch_id")
    List<Map<String, Object>> getOrderStatistics();

    @Select("SELECT DATE(OrderDate) AS date, COUNT(*) AS orderCount " +
            "FROM orders " +
            "GROUP BY DATE(OrderDate) " +
            "ORDER BY date ASC")
    List<Map<String, Object>> getDateOrderStatistics();

}
